package com.huwaiwai.jvm.d20200524;

/**
 * @author 歪大哥😁
 * @date 2020-05-24.
 */
public class GCTest {

    static GCTest t = new GCTest();

    @Override
    protected void finalize() throws Throwable {
        System.out.println("被调用了");
        t = this;
    }


    public static void main(String[] args) throws InterruptedException {
        t = null;
        System.gc();
        Thread.sleep(1000L);
        System.out.println(t == null);

        t = null;
        System.gc();
        Thread.sleep(1000L);
        System.out.println(t == null);
    }



}
